#include "Texture.h"
#include "DDSTextureLoader.h"

Texture::Texture( wchar_t* texturefilepath ) : m_texturefilepath(texturefilepath),
	m_textureResourceView(nullptr),
	m_isD3DInitialized(false)
{
}

Texture::~Texture(void)
{
	ClearD3d();
}

HRESULT Texture::InitializeD3D( ID3D11Device* d3dDevice )
{
	return DirectX::CreateDDSTextureFromFile( d3dDevice, m_texturefilepath, nullptr, &m_textureResourceView );
	m_isD3DInitialized;
}

ID3D11ShaderResourceView*const* Texture::GetResourceView( void ) const
{
	return &m_textureResourceView;
}

void Texture::ClearD3d( void )
{
	if( m_textureResourceView ) m_textureResourceView->Release();
	m_textureResourceView = nullptr;
	m_isD3DInitialized = false;
}

bool Texture::IsD3DInitialized( void ) const
{
	return m_isD3DInitialized;
}